package cn.iocoder.yudao.module.pypm.dal.mysql.comment;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pypm.dal.dataobject.comment.CommentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pypm.controller.admin.comment.vo.*;

/**
 * 评论 Mapper
 *
 * @author 钦州码头
 */
@Mapper
public interface CommentMapper extends BaseMapperX<CommentDO> {

    default PageResult<CommentDO> selectPage(CommentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CommentDO>()
                .eqIfPresent(CommentDO::getRelevanceId, reqVO.getRelevanceId())
                .betweenIfPresent(CommentDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CommentDO::getContent, reqVO.getContent())
                .eqIfPresent(CommentDO::getMkcontent, reqVO.getMkcontent())
                .eqIfPresent(CommentDO::getProjectId, reqVO.getProjectId())
                .eqIfPresent(CommentDO::getUserId, reqVO.getUserId())
                .eqIfPresent(CommentDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(CommentDO::getParentId, reqVO.getParentId())
                .orderByDesc(CommentDO::getId));
    }

}